//
//  DailyThemesViewModel.m
//  HLZhiHuDaily
//
//  Created by 胡林 on 16/3/1.
//  Copyright © 2016年 胡林. All rights reserved.
//

#import "DailyThemesViewModel.h"
#import "StoryModel.h"
@implementation DailyThemesViewModel
///侧滑栏的选项
//给侧滑栏赋值
- (void)getDailyThemesDataWithThemeID:(NSNumber *)themeID {
    [RequestURL getRequestWithUrl:[NSString stringWithFormat:@"theme/%@",themeID] parameters:nil success:^(id responseObject) {
        //数据全局化
        NSDictionary *jsonDic = (NSDictionary *)responseObject;
        NSArray *storiesArr = jsonDic[@"stories"];
        NSMutableArray* tempArr = [NSMutableArray array];
        for (NSDictionary *dic in storiesArr) {
            StoryModel *model = [[StoryModel alloc] initWithDictionary:dic];
            [tempArr addObject:model];
        }
        [self setValue:tempArr forKey:@"stories"];
        [self setValue:jsonDic[@"background"] forKey:@"imageURLStr"];
        [self setValue:jsonDic[@"name"] forKey:@"name"];
        [self setValue:jsonDic[@"editors"] forKey:@"editors"];

    } failure:nil];
    
    
}

@end
